<?php
$dtds = array(
	"username" => array(
		"label" => "用户名",
		"rules" => array(
			"required" => true,
			"min_length" => 3
		),
	),
	"password" => array(
		"label" => "密码",
		"rules" => array(
			"required" => true,
			"min_length" => 1
		),
	),
	"email" => array(
		"label" => "邮件地址",
		"rules" => array(
			"required" => true,
			"min_length" => 6
		),
	),
	"password_confirm" => array(
		"label" => "确认密码",
		"rules" => array(
			"required" => true,
			"equal_to" => new ConfigExpression('$this->context->post("password");')
		),
		"explain" => array(
			"equal_to" => "两次输入的密码不一致"
		)
	),
);

/**
 * User/DoSignup
 */
$myAppConfig["dtd"]["User"]["DoSignup"]["username"] = $dtds["username"];
$myAppConfig["dtd"]["User"]["DoSignup"]["password"] = $dtds["password"];
$myAppConfig["dtd"]["User"]["DoSignup"]["email"] = $dtds["email"];
$myAppConfig["dtd"]["User"]["DoSignup"]["password_confirm"] = $dtds["password_confirm"];
$myAppConfig["dtd"]["User"]["DoSignup"]["captcha_word"] = array(
	"label" => "验证码",
	"rules" => array(
		"required" => true,
		"equal_to" => new ConfigExpression('Captcha::getWord(Cookie::getCookie("captcha_seed"));')
	),
	"explain" => array(
		"equal_to" => "%s不正确"
	)
);

/**
 * User/DoSignin
 */
$myAppConfig["dtd"]["User"]["DoSignin"]["username"] = $dtds["username"];
$myAppConfig["dtd"]["User"]["DoSignin"]["password"] = $dtds["password"];

/**
 * User/DoChangePassword
 */
$myAppConfig["dtd"]["User"]["DoChangePassword"]["password"] = $dtds["password"];
$myAppConfig["dtd"]["User"]["DoChangePassword"]["password_confirm"] = $dtds["password_confirm"];